#pragma once
#include<string>
#include"const.h"
#include<iostream>
#include<boost/asio.hpp>
using namespace std;
using boost::asio::ip::tcp;

class MsgNode
{
public:

	MsgNode(short max_len) :_total_len(max_len), _cur_len(0){
		_data = new char[_total_len + 1];
		_data[_total_len] = '\0';
	}
	~MsgNode() {
		std:: cout << "destruct MsgNode" << std::endl;
		delete[]_data;
	}
	void Clear() {
		::memset(_data, 0, _total_len);
		_cur_len = 0;
	}//清除数据但不回收内存
//protected:
	short _total_len;
	short _cur_len;
	char* _data;

};
class RecvNode :public MsgNode {
public:
	RecvNode(short max_len, short msg_id);

	short _msg_id;
};
class SendNode :public MsgNode {
public:
	SendNode(const char* msg,short max_len, short msg_id);

	short _msg_id;
};